home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 8
/
FM Towns Free Software Collection 8.iso
/
fb386
/
eiyoukei
/
ssort.bas
< prev
next >
Wrap
BASIC Source File
|
1994-06-01
|
1KB
|
35 lines
10 'SAVE "SSORT.BAS",A
20 '日本食品標準成分表SORT
30 ' V1.0 91.04.10
35 CONSOLE 0,24,1:CLS:COLOR 7
40 OPEN "(128)SEIBUN.DAT" AS #1
50 FIELD #1,4 AS FC$,16+32 AS FS$
55 FIELD #1,128 AS FW$
60 N=LOF(1)
65 DIM S$(N),W$(N)
70 FOR I=1 TO N
75 GET #1,I:S$(I)=FS$:W$(I)=FW$':LSET FC$=MKS$(I):PUT #1,I
80 PRINT USING "#### ";CVS(FC$);
90 PRINT FS$
150 NEXT I
1000 *QSORT
1005 PRINT "ソート中ですしばらくおまちください。"
1010 II=I:JJ=J:S=1:SL(1)=1:SR(1)=N
1020 L=SL(S):R=SR(S):S=S-1
1030 I=L:J=R:X$=S$(INT((L+R)/2))
1040 IF S$(I)<X$ THEN I=I+1:GOTO 1040
1050 IF X$<S$(J) THEN J=J-1:GOTO 1050
1060 IF I<=J THEN SWAP S$(I),S$(J):SWAP W$(I),W$(J):I=I+1:J=J-1
1070 IF I<=J THEN 1040
1080 IF I<R THEN S=S+1:SL(S)=I:SR(S)=R
1090 R=J
1100 IF L<R THEN 1030
1110 IF S<>0 THEN 1020
1120 I=II:J=JJ
1130 *QSORTEND
2000 FOR I=1 TO N
2005 LSET FW$=W$(I):PUT #1,I
2010 PRINT USING "#### ";CVS(MID$(W$(I),1,4));:PRINT S$(I)
2020 NEXT I
2030 CLOSE:RUN "MENTE.BAS"